//============================================================================
// Name        : Project.cpp
// Author      : Andrew Martin
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cv.h>
#include <highgui.h>
#include "helpers.h"

using namespace std;
using namespace cv;

int main(int argc, char** argv)
{
	Mat imgLeft, imgRight, imgMono;
	Mat imgTempl, imgTemplFloat, imgMonoFloat;
	loadImages(String(argv[0]), "proj2-pair1-L.png", "proj2-pair1-L-Cropped.png", &imgRight, &imgLeft);
	imgTempl = fromChannel(imgLeft, 1);
	imgMono = fromChannel(imgRight, 1);
	imgTempl.convertTo(imgTemplFloat, CV_32FC1);
	imgMono.convertTo(imgMonoFloat, CV_32FC1);
	scaleVals(imgTemplFloat, 1.0f / 255.0f);
	scaleVals(imgMonoFloat, 1.0f / 255.0f);

	cout << "Hello World!!!" << endl;
	cout << imgTemplFloat.cols << endl;
	int difference = ssdValue(imgTemplFloat, imgMonoFloat, 300, 300);
	cout << "Difference: " << difference << endl;
	Point2i best = bestMatch(imgTemplFloat, imgMonoFloat);
	cout << "x: " << best.x << ", y: " << best.y << endl;
	//imshow("Left Image", imgTempl);
	imshow("Left Image2", imgMonoFloat);
	waitKey();
	return 0;
}
